package MathHomeWorkTest;

import java.util.Scanner;

/*
键盘输入任意一个正整数，求各位数字之和。
 */
public class MathTest18 {
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        System.out.println("请输入一个任意整数：");
        int num = s.nextInt();
        int sum = 0;
        while(num != 0){
            sum += num % 10;
            num /=10;
        }
        System.out.println(sum);
    }
}
